home *** CD-ROM | disk | FTP | other *** search
- import java.util.Random;
-
- class Bomba$AnimationCanvas$CarsEngine {
- // $FF: renamed from: w int
- int field_0;
- // $FF: renamed from: h int
- int field_1;
- long count;
- Location[] vec;
- Random random;
- // $FF: synthetic field
- private final Bomba$AnimationCanvas this$1;
-
- Bomba$AnimationCanvas$CarsEngine(Bomba$AnimationCanvas this$1) {
- this.this$1 = this$1;
- this.random = new Random();
- this.vec = new Location[4];
- }
-
- void init(int w, int h) {
- this.count = 0L;
- this.field_1 = h;
- this.field_0 = w;
- this.vec[0] = new Location(5, 0);
- this.vec[1] = new Location(10, -30);
- this.vec[2] = new Location(30, -h);
- this.vec[3] = new Location(40, -2 * h / 3);
- }
-
- void tick() {
- ++this.count;
- if (this.count % 50L == 0L && this.count < 5000L) {
- --this.this$1.delay;
- System.out.println("delay=" + this.this$1.delay);
- }
-
- for(int i = 0; i < this.vec.length; ++i) {
- this.vec[i].tick();
- }
-
- for(int i = 0; i < this.vec.length; ++i) {
- if (this.vec[i].y > this.field_1) {
- Location temp = new Location();
-
- do {
- temp.x = 2 + Math.abs(this.random.nextInt() % (this.field_0 - 14));
- temp.y = -1 * Math.abs(this.random.nextInt() % (3 * this.field_1));
- } while(!this.method_0(temp));
-
- System.out.println("### temp.x=" + temp.x + " temp.y=" + temp.y);
-
- for(int b = 0; b < this.vec.length; ++b) {
- System.out.println("### vec[" + b + "]=" + this.vec[b].x + "," + this.vec[b].y);
- }
-
- this.vec[i] = temp;
- }
- }
-
- }
-
- // $FF: renamed from: ok (Location) boolean
- boolean method_0(Location temp) {
- boolean result = true;
-
- for(int i = 0; i < this.vec.length && result; ++i) {
- if ((temp.x <= this.vec[i].x && temp.x >= this.vec[i].x - 66 || temp.x >= this.vec[i].x && temp.x <= this.vec[i].x + 66) && (temp.y <= this.vec[i].y && temp.y >= this.vec[i].y - 66 || temp.y >= this.vec[i].y && temp.y <= this.vec[i].y + 66)) {
- result = false;
- }
-
- if (Math.abs(temp.y - this.vec[i].y) < 20) {
- result = false;
- }
- }
-
- return result;
- }
-
- Location[] getLocations() {
- return this.vec;
- }
- }
-